package vn.ivs.taxiapp.fragments;

import vn.ivs.taxiapp.R;
import vn.ivs.taxiapp.application.BaseApplication;
import vn.ivs.taxiapp.models.TaxiInfo;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;

public class S009Fragment extends Fragment implements OnClickListener {
	private TextView mTvDesciption;
	private Button mBtnGotoS002;
	private TextView tvHeaderTitle;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
	}

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		View v = inflater.inflate(R.layout.fragment_s009, container, false);
		mTvDesciption = (TextView) v.findViewById(R.id.s009_content);
		mBtnGotoS002 = (Button) v.findViewById(R.id.s009_btn);
		mBtnGotoS002.setOnClickListener(this);

		// ini
		TaxiInfo info = BaseApplication.mCurrentTaxi;
		mTvDesciption.setText(info.getDescription());
		tvHeaderTitle = (TextView) getActivity().findViewById(
				R.id.tvHeaderTitle);
		tvHeaderTitle.setText(info.getName());

		return v;
	}

	@Override
	public void onClick(View v) {
		if (v.equals(mBtnGotoS002)) {
			Fragment newFragment = new S002Fragment();
			FragmentTransaction transaction = getFragmentManager()
					.beginTransaction();

			// Replace whatever is in the fragment_container view with this
			// fragment,
			// and add the transaction to the back stack
			transaction.add(android.R.id.tabcontent, newFragment);
			transaction.addToBackStack(null);

			// Commit the transaction
			transaction.commit();
		}

	}

}
